package com.hxkj.controller.article;

import com.hxkj.domain.po.Tags;
import com.hxkj.domain.po.TagsClassify;
import com.hxkj.service.article.TagsService;
import com.platform.common.dispatcher.util.ResultStructUtils;
import com.platform.common.domain.result.ParameterDataStruct;
import com.platform.common.domain.result.ResultDataStruct;
import com.platform.common.domain.result.ResultPageStruct;
import com.platform.common.domain.to.PageTo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.concurrent.Callable;


/**
 * @ClassName TagsController
 * @Description TODO
 * @Author Mr.zheng
 * @Date 2018/6/7 11:57
 * @Version 1.0
 */
@RestController
@RequestMapping("/tags")
public class TagsController {

    @Autowired
    TagsService tagsService;
    /**
     * @Description saveTags 新增tags标签
     **/
    @RequestMapping(value = "/save", method = RequestMethod.POST)
    public void saveTags(@ModelAttribute Tags tags) throws Exception{
        tagsService.saveTags(tags);
    }

    /**
     * @Description getTagsList 获取tags标签列表
     **/
    @RequestMapping(value = "/getlist", method = RequestMethod.POST)
    public Callable<ResultPageStruct<Tags>> getTagsList(@ModelAttribute Tags tags, @ModelAttribute PageTo pageParam) throws Exception{
        return () -> tagsService.getTagsList(tags,pageParam);
}

    /**
     * @Description getTags 根据条件获取tags标签
     **/
    @RequestMapping(value = "/get", method = RequestMethod.POST)
    public ResultDataStruct<Tags> getTags(@ModelAttribute Tags tags) throws Exception{
        return null;
    }

    /**
     * @Description removerTags 删除tags标签
     **/
    @RequestMapping(value = "/remove", method = RequestMethod.POST)
    public void removeTags(@ModelAttribute Tags tags) throws Exception{
        tagsService.removeTags(tags);
    }

    /**
     * @Description modifyTags 修改tags标签
     **/
    @RequestMapping(value = "/modify", method = RequestMethod.POST)
    public void modifyTags(@ModelAttribute Tags tags) throws Exception{
       tagsService.modifyTags(tags);
    }

    /**
    * @Description getShowTagsList 获取tags标签下拉框
    **/
    @RequestMapping(value = "/getshowlist", method = RequestMethod.POST)
    public Callable<List<Tags>> getShowTagsList(@ModelAttribute Tags tags) throws Exception{
        return () -> tagsService.getShowTagsList(tags);

    }

    /**
     * @Description getHotTagsList 获取热词标签
     **/
    @RequestMapping(value = "/getHotTagsList", method = RequestMethod.POST)
    public Callable<ResultPageStruct<Tags>> getHotTagsList(@ModelAttribute Tags tags, @ModelAttribute PageTo pageParam) throws Exception{
        return () -> tagsService.getHotTagsList(tags,pageParam);
    }
}
